#include "SaveProjectDialog.h"
#include<QVBoxLayout>

SaveProjectDialog::SaveProjectDialog(QWidget *parent, Qt::WindowFlags f)
    : QDialog(parent, f)
{
    m_Label_Tip =new QLabel(this);
    m_Label_Tip->setText("do you want to save the project?");

    m_DialogButtonBox =new QDialogButtonBox(this);
    btn_ok = m_DialogButtonBox->addButton(QDialogButtonBox::Save);
    btn_no = m_DialogButtonBox->addButton(QDialogButtonBox::No);
    btn_ok->setDefault(true);   // 设置默认按钮（按Enter键触发）

    QVBoxLayout *vlayout =new QVBoxLayout(this);
    vlayout->addWidget(m_Label_Tip);
    vlayout->addWidget(m_DialogButtonBox);

    connect(btn_ok,&QPushButton::clicked,[this]() { done(QDialogButtonBox::Save); });
    connect(btn_no,&QPushButton::clicked,[this]() { done(QDialogButtonBox::No); });
}
